<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>社医堂</title>
<link rel="stylesheet" type="text/css" href="../../../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../../../css/hui.css" />
    <link rel="stylesheet" type="text/css" href="../../../css/iconfont.css" />
</head>
<style>
body{background-color: #fff;}
#health{width:100%}
#health li{float:left;text-align:center;height:36px;line-height:36px;background-color:#7BCAFF;}
.hui-segment-active2{background-color:#45b3fc !important;}
</style>
<body>
<header class="hui-header">
    <div id="hui-back"></div>
    <h1>上报数据</h1>
	<div id="hui-header-menu" onclick="showupdata()"></div>
</header>

<div class="hui-wrap" style="margin-top:27px;">
	<div style="padding:0px;margin:0px;">
		<ul id="health">
			
		</ul>
	</div>

</div>

<footer id="hui-footer"></footer>

<script src="../../../script/hui.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../script/hui-tab.js" type="text/javascript"></script>
<script src="../../../script/api.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../script/stm.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
apiready=function(){	

	var id = api.pageParam.id;
	var header = $api.dom('header');
	var headerH = $api.fixStatusBar(header)+36;
	var footer = $api.dom('footer');
	var footerH = $api.fixTabBar(footer);
	var mainheight = api.winHeight-footerH-headerH;
	//document.getElementById("footer").style.marginTop = mainheight;
	

	setfooter(1)
	api.openFrame({
		name: 'up_frm',
		url:'up_frm.html',
		pageParam:{id:id},
		rect: {
			x: 0,
			y: headerH,
			w: 'auto',
			h: mainheight
		}
	})

	health()
	
	

}

function health(){

	$api.setStorage('healthnum',0)
	if($api.getStorage('health')!='' && $api.getStorage('health')!=null){
		var health = $api.getStorage('health')+'';
	}else{
		var health = '血压,血脂,血糖,慢性肺阻';
	}

	var healthArr = health.split(",")
	var html = '';
	var width = 100/healthArr.length
	$api.setStorage('healthnum',healthArr.length)

	for(i=0;i<healthArr.length;i++){
		var bg = '';
		if(i==0){ bg = 'hui-segment-active2'; }
		html += "<li id='menu_"+i+"' onclick=tab('"+healthArr[i]+"',"+i+") style='width:"+width+"%;' class='"+bg+"'>"+healthArr[i]+"</li>"
	}
	hui("#health").html(html)

}


function tab(v,i){
	for(var a=0;a<4;a++){
		if(i==a){
			hui("#menu_"+a).addClass("hui-segment-active2");
		}else{
			hui("#menu_"+a).removeClass("hui-segment-active2");
		}
	}
	
	api.execScript({
		//name: 'up_record_win',
		frameName: 'up_frm',
		script: 'tab("'+v+'",'+i+');'
	});
}

/*function changeDom(i){

	var header = $api.dom('header');
	var headerH = $api.fixStatusBar(header)+70;
	var footer = $api.dom('footer');
	var footerH = $api.fixTabBar(footer);
	var mainheight = api.winHeight-footerH-headerH;

	if (i==1) {
		hui("#tab1").addClass("hui-segment-active");
		hui("#tab2").removeClass("hui-segment-active");
		api.openFrame({
			name: 'up_frm1',
			url:'up_frm1.html',
			rect: {
				x: 0,
				y: headerH,
				w: 'auto',
				h: mainheight
			}
		})

	} else {

		hui("#tab1").removeClass("hui-segment-active");
		hui("#tab2").addClass("hui-segment-active");
		api.openFrame({
			name: 'up_frm1',
			url:'up_frm2.html',
			rect: {
				x: 0,
				y: headerH,
				w: 'auto',
				h: mainheight
			}
		})	
	}
	
}*/




</script>

</body>
</html>